home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #5 & #6 / Amiga Plus CD - 1995 - No. 5 and 6.iso / pd / serien / purity / nr.10 / demo / vdx.i / pic.i next >
Text File  |  1995-04-19  |  2KB  |  79 lines

  1.  
  2. {  Pic.i   4 sparky  }
  3.  
  4. {$I "Include:graphics/gfxbase.i"   }
  5. {$I "Include:intuition/screens.i"  }
  6. {$I "Include:Utils/stringlib.i"    }
  7. {$I "Include:libraries/iff.i"      }
  8.  
  9. Function ShowPix( arg : String ): String;
  10.  
  11. Const
  12.     ns : NewScreen =  (0,0,0,0,0,0,0,0,CUSTOMSCREEN_f+SCREENQUIET_f,
  13.                NIL, NIL, NIL, NIL);
  14.  
  15. Var
  16.     MyIff      : IffFile;
  17.     count      : Integer;
  18.     colortable : Array[1..128] of Short;
  19.     bmhd       : BitMapHeaderPtr;
  20.     myscreen   : ScreenPtr;
  21.  
  22.  
  23.  
  24. Procedure ClearShowPix;
  25. Begin
  26.     if myscreen <> NIL then CloseScreen( myscreen );
  27.     if MyIff<>NIL  then CloseIFF(MyIff);
  28. End;
  29.  
  30.  
  31. { -- Hauptprogramm -- }
  32.  
  33. BEGIN
  34.     myscreen := NIL;
  35.  
  36.     { -- IFF-Pic laden -- }
  37.     MyIff:=OpenIFF(arg);
  38.     if MyIff=NIL then begin
  39.       ClearShowPix;
  40.       ShowPix := "Unable 2 load pic";
  41.     end;
  42.  
  43.     { -- Bitmap-Header holen -- }
  44.     bmhd := GetBMHD(MyIff);
  45.     if  bmhd = NIL then begin
  46.       ClearShowPix;
  47.       ShowPix := "BitMapHeader not found";
  48.     end;
  49.  
  50.     ns.Width      := bmhd^.w;        { -- Infos zum Pic -- }
  51.     ns.Height     := bmhd^.h;        { -- holen, für    -- }
  52.     ns.Depth      := bmhd^.nPlanes;        { -- den Screen    -- }
  53.     ns.ViewModes  := GetViewModes(MyIff);
  54.                         { -- Screen öffnen -- }
  55.     myscreen := OpenScreen(Adr(ns));
  56.     if  myscreen = NIL then begin
  57.       ClearShowPix;
  58.       ShowPix := "Can't open screen 4 pic!";
  59.     end;
  60.                         { -- Farben setzen -- }
  61.     count := GetColorTab(MyIff,Adr(colortable));
  62.     if (count>32) then  count:=32;
  63.     { -- HAM/Halfbrite-Pictures haben 64++ Farben -- }
  64.  
  65.     LoadRGB4(Adr(myscreen^.SViewPort),Adr(colortable),count);
  66.  
  67.     { -- Pic ggf. decodieren und in den Screen kopieren -- }
  68.     if NOT DecodePic(MyIff,Adr(myscreen^.SBitMap)) then
  69.         if myscreen<>NIL then begin
  70.           ClearShowPix;
  71.           ShowPix :=  "Can't decode picture";
  72.         end;
  73.  
  74.     Delay(300);              { -- 4 Secs warten -- }
  75.  
  76.     ClearShowPix;            { -- Prc. sauber verlassen -- }
  77.     ShowPix := "Yeah !";
  78. End;
  79.